package com.starlink.utils;

import java.security.*;
import java.util.Base64;


/**
 * 微信工具类
 */
public class WeixinUtil {

    public static String sign(byte[] message, PrivateKey privateKey) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {
        Signature sign = Signature.getInstance("SHA256withRSA");
        sign.initSign(privateKey);
        sign.update(message);
        return Base64.getEncoder().encodeToString(sign.sign());
    }
}